package com.qiwx.pigeon.adapter.stock;

import android.content.Intent;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.qiwx.pigeon.R;
import com.qiwx.pigeon.Utils.MyToast;
import com.qiwx.pigeon.activity.stock.AddGoodActivity;
import com.qiwx.pigeon.data.vo.stock.CustomerBean;
import com.qiwx.pigeon.data.vo.stock.GoodCategory;

import java.util.List;

/**
 * @description
 * @Author qiwx
 * @Date 2020/9/2 6:27 PM
 **/
public class GoodCateAdapter extends BaseQuickAdapter<GoodCategory, BaseViewHolder> {


    public GoodCateAdapter(int layoutResId) {
        super(layoutResId);
    }

    public GoodCateAdapter(int layoutResId, List<GoodCategory> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, GoodCategory bean) {
        holder.setText(R.id.txt_name, bean.getName());
        String amont = bean.getQuantity() + "( " + bean.getUnit_name() + " )";
        holder.setText(R.id.txt_stock_amount, "当前库存：" + amont);
        holder.getView(R.id.img_stock_add).setOnClickListener(v -> {
            Intent go = new Intent(getContext(), AddGoodActivity.class);
            go.putExtra("obj", bean);
            getContext().startActivity(go);
        });

    }
}

